package edu.pku.sei.modeler.uml.commands.sequence;

import edu.pku.sei.modeler.model.core.MetaModelElement;
import edu.pku.sei.modeler.model.structure.MetaNode;
import edu.pku.sei.modeler.model.uml.BasicInteractions.Lifeline;
import edu.pku.sei.modeler.uml.commands.NestedElementDeleteCommand;
import edu.pku.sei.modeler.uml.commands.NestedPackageElementDeleteCommand;

public class UMLExecutionOccurrenceDeleteCommand extends
		NestedElementDeleteCommand {

	public UMLExecutionOccurrenceDeleteCommand(MetaNode node,
			MetaNode fatherNode, boolean isDeletedFromDiagram) {
		super(node, fatherNode, isDeletedFromDiagram);
	}

	@Override
	protected void deleteModelElement() {
		Lifeline lifeline = (Lifeline) fatherNode.getModelElement();
		lifeline.getIncludedExecutionOccurrences().remove(node.getModelElement());
	}

	@Override
	protected void undoDeleteModelElement() {
		MetaModelElement modelElement = this.node.getModelElement();
		Lifeline lifeline = (Lifeline) this.fatherNode.getModelElement();
		lifeline.getIncludedExecutionOccurrences().add(modelElement);
		
	}

	
	
}
